'use strict'

class comment{
  constructor(){
    this.param = '/'
  }

  async post(c){
    let a = c.service.fun;
    let {user_id,comment_txt,article_id,comment_time} = JSON.parse(c.body);
    console.log(user_id);
    c.setHeader('content-type', 'text/html; charset=utf-8')
    try{ 
      a.add('comment_list',{'comment_article_id':`${article_id}`,'comment_txt':`${comment_txt}`,'comment_time':`${comment_time}`,'comment_user_id':`${user_id}`},c.service.pool);
      c.send('ok')
    }catch(e){
      console.log(e.message)
    }
  }
}
module.exports = comment;
